use tauri::ipc::Invoke;

#[tauri::command]
fn greet(name: &str) -> String {
    format!("你好, {}! 欢迎创建tauri应用", name)
}

#[tauri::command]
fn hellow_tauri() -> String {
    "hellow_tauri".to_string()
}
#[tauri::command]
fn get_data() -> String {
    use tokio::runtime::Runtime;
    let rt = Runtime::new().unwrap();
     rt.block_on(async {
            reqwest::get("https://www.rust-lang.org")
                .await.unwrap()
                .text()
                .await.unwrap()

    })
}

pub fn use_commands() -> impl Fn(Invoke) -> bool {
    tauri::generate_handler![greet, hellow_tauri, get_data]
}
